package sk.stuba.fiit.foo07.genex.dao;

import java.sql.SQLException;
import java.util.ArrayList;

import sk.stuba.fiit.foo07.genex.beans.Category;
import sk.stuba.fiit.foo07.genex.exceptions.QuestionInCategoryException;
import sk.stuba.fiit.foo07.genex.exceptions.TestInTestCategoryException;

/**
 * @author _mizu_
 * 
 */
public interface CategoryDao {

    /**
     * Method for getting category.
     * 
     * @param categoryID
     *                id of category
     * @return category
     * 
     */

    public Category getCategoryByID(Integer categoryID) throws SQLException;

    /**
     * Method for getting root category.
     * 
     * @return root category
     * 
     */

    public ArrayList<Category> getRootCategories() throws SQLException;

    /**
     * Method for getting child categories.
     * 
     * @param categoryID
     *                id of category
     * @return categories
     * 
     */

    public ArrayList<Category> getCategoriesByParentID(Integer categoryID)
            throws SQLException;

    /**
     * Method for getting test category.
     * 
     * @param testCategoryID
     *                id of test Category
     * 
     * @return test Category
     * 
     */

    public Category getTestCategoryByID(Integer testCategoryID)
            throws SQLException;

    /**
     * getCategoryByQuestionID
     * 
     * @param questionID
     *                id of questionID
     * 
     * @return int
     * 
     */

    @Deprecated
    public int getCategoryByQuestionID(Integer questionID) throws SQLException;

    /**
     * Method for getting categories by question id.
     * 
     * @param questionID
     *                id of question
     * @return Integer
     * 
     */

    public ArrayList<Integer> getCategoriesIDByQuestionID(Integer questionID)
            throws SQLException;

    /**
     * Method for getting answers.
     * 
     * @param answerID
     *                id of answer
     * @param name
     *                the location of the image, relative to the url argument
     * @return answer
     * 
     */

    public ArrayList<Category> getCategoriesByName(String name)
            throws SQLException;

    /**
     * Method for getting root test category.
     * 
     * @return root test category
     * 
     */

    public ArrayList<Category> getRootTestCategories() throws SQLException;

    /**
     * Tests if a category has subcategories.
     * 
     * @param categoryID
     *                id of category
     * @return bool
     * 
     */

    public boolean hasTestSubcategories(Integer categoryID) throws SQLException;

    /**
     * Tests if a category has subcategories.
     * 
     * @param categoryID
     *                id of category
     * @return bool
     * 
     */

    public boolean hasSubcategories(Integer categoryID) throws SQLException;

    /**
     * Method for get Test Categories By ParentID.
     * 
     * @param categoryID
     *                id of category
     * 
     * @return categories
     * 
     */

    public ArrayList<Category> getTestCategoriesByParentID(Integer categoryID)
            throws SQLException;

    /**
     * Method for adding category.
     * 
     * @param parentCategoryID
     *                id of category parent for adding
     * @param toAdd
     *                category which is being added
     * @return answer
     * 
     */

    public void addCategory(Integer parentCategoryID, Category toAdd)
            throws SQLException;

    /**
     * Method for adding category.
     * 
     * @param toAdd
     *                root category which is being added
     * @return answer
     * 
     */

    public void addRootCategory(Category toAdd) throws SQLException;

    /**
     * Method for adding test category.
     * 
     * @param parentTestCategoryID
     *                id of test category parent for adding
     * @param toAdd
     *                test category which is being added
     * @return answer
     * 
     */

    public void addTestCategory(Integer parentTestCategoryID, Category toAdd)
            throws SQLException;

    /**
     * Method for getting adding root test categoies.
     * 
     * @param toAdd
     *                added root category
     * 
     * @return answer
     * 
     */

    public void addRootTestCategory(Category toAdd) throws SQLException;

    /**
     * Method for getting adding categories.
     * 
     * @param parentCategoryID
     *                where is being added
     * @param toAdd
     *                list of added categories
     * 
     */

    public void addCategories(Integer parentCategoryID,
            ArrayList<Category> toAdd) throws SQLException;

    /**
     * Method for getting adding categories.
     * 
     * @param parentCategoryID
     *                where is being added
     * @param toAdd
     *                list of added categories
     * 
     */

    public void addTestCategories(Integer parentTestCategoryID,
            ArrayList<Category> toAdd) throws SQLException;

    /**
     * Method for updating category.
     * 
     * @param toUpdate
     *                category which is being updated
     * 
     */

    public void updateCategory(Category toUpdate) throws SQLException;

    /**
     * Method for updating test category.
     * 
     * @param toUpdate
     *                test category which is being updated
     * 
     */

    public void updateTestCategory(Category toUpdate) throws SQLException;

    /**
     * Method for deleting categories.
     * 
     * @param toDelete
     *                deleting this category
     * 
     * 
     */

    public void deleteCategory(Category toDelete)
            throws QuestionInCategoryException, SQLException;

    /**
     * Method for deleting test categories.
     * 
     * @param toDelete
     *                deleting this test category
     * 
     * 
     */

    public void deleteTestCategory(Category toDelete)
            throws TestInTestCategoryException, SQLException;

    /**
     * Method for deleting categories.
     * 
     * @param toDelete
     *                deleting this list of categories
     * 
     * 
     */

    public void deleteCategories(ArrayList<Category> toDelete)
            throws QuestionInCategoryException, SQLException;

    /**
     * Method for deleting test categories.
     * 
     * @param toDelete
     *                deleting this list of test categories
     * 
     * 
     */

    public void deleteTestCategories(ArrayList<Category> toDelete)
            throws TestInTestCategoryException, SQLException;

    /**
     * Method for copying categories.
     * 
     * @param toCopy
     *                what category to copy
     * @param destination
     *                where to copy the category
     * 
     * 
     */

    public void copyCategory(Category toCopy, Category destination)
            throws SQLException;

    /**
     * Method for copying categories.
     * 
     * @param toCopy
     *                what category to copy
     * @param destination
     *                where to copy the category
     * 
     * @return Integer
     */

    public Integer copyCategory(Integer toCopyID, Category destination)
            throws SQLException;
}
